import React from 'react'
import ReactDom from 'react-dom'
import {createStore,applyMiddleware,compose} from 'redux'
import chunk from 'redux-thunk'
import {Provider} from 'react-redux'
import {BrowserRouter ,Route,Link,Redirect,Switch }from 'react-router-dom'

import reducers from './reducer.js'
import Auth from './Auth.js'
import Dashboard from './Dashboard.js'

const store = createStore(reducers,compose(applyMiddleware(chunk),window.devToolsExtension?window.devToolsExtension():(f)=>{f}))



ReactDom.render(
    (<Provider store={store}>
        <BrowserRouter>
        <div>

            <Switch>
                <Route path="/login"  component={Auth}></Route>
                <Route path="/dashboard" component={Dashboard}></Route>
                <Redirect to="/dashboard"></Redirect>
            </Switch>            
            </div>

        </BrowserRouter>
    </Provider>),document.getElementById('root'))